/*****************************************************************************
 *
 * Weber State University
 * CS4280 Spring 2010
 * Final Group Assignment
 *
 *
 *   TTTTTT                               CCCCC
 *     TT   EEEEE   A    M   M          CC      C
 *     TT   E      A A   M   M         CC   
 *     TT   E     A   A  MM MM  -----  CC
 *     TT   EEE   AAAAA  M M M  -----  CC
 *     TT   E     A   A  M   M          CC      C
 *     TT   EEEEE A   A  M   M            CCCCC
 *
 *   Jared Pack ---- Jon Mann ---- Joshua Clayton
 *
 *
 * A flythrough of a simple textured 3D scene
 *
 ****************************************************************************/

 /* FILENAME wall.cpp
  *
  * Change control Section
  *
  * Team Member: Jared Pack
  * Version: 0.1
  * Date: 04/7/2010
  *		Added the ability to texture the wall with an image.
  *
  * Team Member: Jared Pack
  * Version: 0.2
  * Date: 04/15/2010
  *     Removed the texture feature because it slowed the game down too much.
  *      
  */

#include "wall.h"

Wall::Wall()
{
	//LoadTexture();
}

Wall::~Wall()
{
//    UnloadTexture();
}

//void Wall::LoadTexture(void)
//{
//    texture.LoadTexture("warning.tga");
//	glGenTextures(1, &texture.texID);
//    glBindTexture(GL_TEXTURE_2D, texture.texID);
//    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
//    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
//    
//    /* 2d texture, level of detail 0 (normal),
//     * 3 components (red, green, blue), x size from image,
//     * y size from image, border 0 (normal),
//     * rgb color data, unsigned byte data, and finally the data itself. */
//    glTexImage2D(GL_TEXTURE_2D, 0, 3, texture.width, texture.height,
//                 0, GL_RGB, GL_UNSIGNED_BYTE, texture.data);
//
//}

//void Wall::UnloadTexture()
//{
//    texture.Unload();
//}

void Wall::Draw(CVector &c)
{
    glPushMatrix();
    glTranslatef(c.x, c.y, c.z);
	glDisable(GL_LIGHTING);
    DrawWall(50);
    glEnable(GL_LIGHTING);
    glPopMatrix();
}

void Wall::DrawWall(GLfloat size)
{
    size /= -2.0;

	glColor3f(0.8f, 0.7f, 0.6f);

    glBegin(GL_QUADS);                  // begin drawing a wall
    glVertex3f(-size, -size,  size);    // Bottom Left Of The wall
    glVertex3f( size, -size,  size);    // Bottom Right Of The wall
    glVertex3f( size,  size,  size);    // Top Right Of The wall
    glVertex3f(-size,  size,  size);    // Top Left Of The wall
 
    glEnd();  
}
void Wall::Draw2(CVector &c)
{
    glPushMatrix();
    glTranslatef(c.x, c.y, c.z);
	glDisable(GL_LIGHTING);
    DrawWall2(50);
    glEnable(GL_LIGHTING);
    glPopMatrix();
}

void Wall::DrawWall2(GLfloat size)
{
    size /= -2.0;

	glColor3f(0.8f, 0.7f, 0.6f);

    glBegin(GL_QUADS);                  // begin drawing a wall
    glVertex3f( size, -size, -size);    // Bottom Right Of The wall
    glVertex3f( size,  size, -size);    // Top Right Of The wall
    glVertex3f( size,  size,  size);    // Top Left Of The wall
    glVertex3f( size, -size,  size);    // Bottom Left Of The wall

    glEnd();  
}